
#include <string.h>

#include "mq.h"

int main() {
	int mq_id = get_mq_id(); 
	
	struct msg_buffer buffer;
	
	printf("enter message type：");	
	scanf("%d", &buffer.mtype);
    printf("enter message content：");
	scanf("%s", &buffer.mtext);
	
	int len = strlen(buffer.mtext) + 1;

    if(msgsnd(mq_id, &buffer, len, IPC_NOWAIT) == -1){
       	perror("fail to send message.");
       	exit(1);
    }

	return 0;
}
